package com.ailink.basic.thread;

import lombok.extern.slf4j.Slf4j;

/**
 * Created by Administrator on 2018/12/29
 */
@Slf4j
public class TestJoin {

    public static void main(String[] args) throws InterruptedException {
        Thread th1 = new Thread(() -> {
            try {
                Thread.sleep(3 * 1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("th1");
            log.info("th1");
        });

        Thread th2 = new Thread(() -> {
            try {
                Thread.sleep(5 * 1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("th2");
            log.info("th2");
        });
        th2.start();
        th1.start();
        th2.join();
        th1.join();
    }
}
